package com.dreamthen.config;

import com.dreamthen.service.BeanOne;
import com.dreamthen.service.BeanTwo;
import com.dreamthen.service.impl.TestServiceImpl;
import com.dreamthen.service.impl.TransferService;
import com.dreamthen.service.impl.YouServiceImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * @Author zengms
 * @Date 2023-10-22 17:00:42
 **/
@Configuration
public class IocConfig {

    @Bean
    public TestServiceImpl testServiceImpl(){
        return new TestServiceImpl();
    }

    @Bean(name = {"transfer1","transfer2"},initMethod = "initTransferService",destroyMethod = "destroyTransferService")
    public TransferService transferService(YouServiceImpl youService){
        return new TransferService(youService);
    }

    @Bean
    public BeanOne beanOne() {
        return new BeanOne(beanTwo());
    }

    @Bean
    public BeanTwo beanTwo() {
        return new BeanTwo();
    }


}
